
import { serializeStyles } from '../serialize';
import { Insertion } from '../utils';
function createStyled(tag) {
  return function (...args) {
    function Styled(props) {
      const serialized = serializeStyles(args, props);
      const className = `css-` + serialized.name;
      const newProps = { ...props, className };
      const FinalTag = props.as || tag;
      return (
        <>
          <Insertion serialized={serialized} />
          <FinalTag {...newProps} />
        </>
      )
    }
    return Styled;
  }
}
const newStyled = createStyled.bind();
const tags = ['div', 'button'];
tags.forEach(tagName => {
  newStyled[tagName] = newStyled(tagName);
});
export default newStyled;